<script setup lang="ts">
import Footer from '../components/Footer.vue';
import { ref } from 'vue';

const loading = ref(false);
const error = ref('');
</script>

<template>
  <div class="news">
    <section class="banner">
      <div class="container">
        <img loading="lazy" src="https://img1.hijs.cc/xubai/images/banner/news.jpg" alt="发展历程banner" class="img-fluid">
      </div>
    </section>
    <section class="news-list">
      <div class="container">
        <div v-if="loading" class="text-center py-5">
          <div class="spinner-border text-primary" role="status">
            <span class="visually-hidden">加载中...</span>
          </div>
        </div>

        <div v-else-if="error" class="alert alert-danger" role="alert">
          {{ error }}
        </div>

        <div v-else class="row">
          <div class="col-12">
            <div class="timeline">
              <div class="timeline-item">
                <div class="timeline-date">2025年</div>
                <div class="timeline-content">
                  <h4>公司扩产</h4>
                  <p>新建厂房扩大生产</p>
                </div>
              </div>
              <div class="timeline-item">
                <div class="timeline-date">2018年</div>
                <div class="timeline-content">
                  <h4>新增设备</h4>
                  <p>新增封口机、吹塑机</p>
                </div>
              </div>
              <div class="timeline-item">
                <div class="timeline-date">2017年</div>
                <div class="timeline-content">
                  <h4>市场拓展</h4>
                  <p>业务覆盖全国主要城市，市场份额稳步提升</p>
                </div>
              </div>
              <div class="timeline-item">
                <div class="timeline-date">2015年</div>
                <div class="timeline-content">
                  <h4>正式投产</h4>
                  <p>正式投产并获得市场认可</p>
                </div>
              </div>
              <div class="timeline-item">
                <div class="timeline-date">2015年</div>
                <div class="timeline-content">
                  <h4>公司成立</h4>
                  <p>沧县旭佰塑料制品厂正式成立</p>
                </div>
              </div>
              <div class="timeline-item">
                <div class="timeline-date">2014年</div>
                <div class="timeline-content">
                  <h4>筹备阶段</h4>
                  <p>完成团队组建和产品研发规划</p>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>


    <Footer />
  </div>
</template>

<style scoped>
.news-list {
  padding: 60px 0;
}

.news-card {
  border: 1px solid #eee;
  border-radius: 4px;
  overflow: hidden;
  transition: all 0.3s ease;
  background: #fff;
}

.news-card:hover {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.news-info {
  padding: 20px 30px;
}

.news-info h3 {
  font-size: 1.2em;
  margin-bottom: 10px;
  color: #333;
  cursor: pointer;
}

.news-date {
  color: #999;
  font-size: 0.9em;
  margin-bottom: 12px;
}

.news-excerpt {
  color: #666;
  line-height: 1.8;
  font-size: 0.95em;
  margin: 0;
}

.timeline {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 0;
}

.timeline::before {
  content: '';
  position: absolute;
  width: 2px;
  background-color: #e0e0e0;
  top: 0;
  bottom: 0;
  left: 50%;
  margin-left: -1px;
  transform: translateX(-15px);
}

.timeline-item {
  padding: 20px 0;
  position: relative;
}

.timeline-date {
  position: absolute;
  width: 120px;
  background: #f5f5f5;
  border-radius: 4px;
  padding: 8px 12px;
  text-align: center;
  left: 50%;
  margin-left: -60px;
  font-weight: bold;
  color: #333;
}

.timeline-content {
  width: 45%;
  padding: 20px;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
  margin-left: 40px;
  margin-right: 40px;
}

.timeline-item:nth-child(odd) .timeline-content {
  margin-left: 15%;
}

.timeline-item:nth-child(even) .timeline-content {
  margin-left: 60%;
}
.banner {
  padding: 60px 0;
  background: #f8f9fa;
  margin-top: 60px;
}

@media (max-width: 768px) {
  .banner {
    margin-top: 40px;
    padding-bottom: 5px;
  }
  
  .timeline::before {
    left: 30px;
    transform: none;
  }
  
  .timeline-item {
    padding-left: 60px;
  }
  
  .timeline-date {
    left: 30px;
    margin-left: 0;
    width: auto;
  }
  
  .timeline-content {
    width: calc(100% - 70px);
    margin-left: 70px !important;
    margin-right: 0 !important;
  }
}
</style>